package Assignment.Test1;

import java.util.ArrayList;

public class Test {
    public static void main(String[] args) {
        //创建集合
        ArrayList<Teacher> list = new ArrayList<>();

        //创建对象
        Teacher t1 = new Teacher("赵老师","javase");
        Teacher t2 = new Teacher("钱老师","javase");
        Teacher t3 = new Teacher("孙老师","php");
        Teacher t4 = new Teacher("李老师","python");

        //将对象添加到集合中
        list.add(t1);
        list.add(t2);
        list.add(t3);
        list.add(t4);

        //遍历
        for (int i = 0; i < list.size(); i++) {
            Teacher t = list.get(i);
            System.out.println("姓名："+t.getName()+"，专业："+t.getCareer());
        }


    }
}
